//
//  NKCaseInform.m
//  NewKY
//
//  Created by MXQ on 2016/11/17.
//  Copyright © 2016年 Dee. All rights reserved.
//

#import "NKCaseInform.h"

@implementation NKCaseInform

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    // 将属性进行编码保存, 指定对应的Key
    [aCoder encodeObject: _caseName forKey:@"CaseName"];
    [aCoder encodeObject: _caseDiscreb forKey:@"CaseDiscreb"];
    [aCoder encodeObject: _saveDate forKey:@"SaveDate"];
    [aCoder encodeObject:_illImage forKey:@"IllName"];
    
}

/**
 * 该方法会将编码的二进制数据还原成对象, 并且恢复对象的属性 (解档)
 * decoder : 解码器
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super init]) {
        // 根据归档时使用的key来恢复对应的属性值
        _caseName = [aDecoder decodeObjectForKey:@"CaseName"];
        _caseDiscreb = [aDecoder decodeObjectForKey:@"CaseDiscreb"];
        _saveDate = [aDecoder decodeObjectForKey:@"SaveDate"];
        _illImage = [aDecoder decodeObjectForKey:@"IllName"];
    }
    return self;
}



- (NSString *)description
{
    return [NSString stringWithFormat:@"<%@: %p: name: %@, money: %@,date: %@,img : %@>", NSStringFromClass(self.class), self, _caseName, _caseDiscreb,_saveDate,_illImage];
}


@end
